package com.itheima.api.stream.demo06;

import java.util.ArrayList;
import java.util.stream.Stream;

public class StreamExercises {

    public static void main(String[] args) {

        ArrayList<String> manActorArrayList = new ArrayList<>();
        ArrayList<String> womanActorArrayList = new ArrayList<>();

        manActorArrayList.add("蓝启仁");
        manActorArrayList.add("蓝忘机");
        manActorArrayList.add("蓝涣");
        manActorArrayList.add("蓝曦臣");
        manActorArrayList.add("蓝愿");
        manActorArrayList.add("蓝思追");

        womanActorArrayList.add("魏婴");
        womanActorArrayList.add("魏无羡");
        womanActorArrayList.add("敛芳尊");
        womanActorArrayList.add("金光瑶");
        womanActorArrayList.add("赤锋尊");
        womanActorArrayList.add("聂明玦");

        Stream<String> manStream = manActorArrayList.stream().filter(s -> s.length() == 3).limit(3);
        Stream<String> womanStream = womanActorArrayList.stream().filter(s -> s.startsWith("魏")).skip(1);

        Stream<String> stream = Stream.concat(manStream, womanStream);
        stream.forEach(s -> {
            Actor actor = new Actor(s);
            System.out.println(actor.getName());
        });


    }
}
